<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "images".
 *
 * @property integer $id
 * @property integer $user_id
 * @property integer $type
 * @property string $img_name
 * @property integer $create_time
 * @property integer $Porright
 * @property string $address
 * @property string $info
 * @property integer $collectnum
 * @property integer $url
 */
class Images extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'images';
    }


    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['user_id', 'type', 'create_time', 'Porright', 'collectnum'], 'integer'],
            [['img_name'], 'string', 'max' => 100],
            [['address', 'info'], 'string', 'max' => 255]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => '图片编码',
            'user_id' => '上传用户',
            'type' => '类型',
            'img_name' => '名称',
            'url' =>'图片',
            'create_time' => '创建时间',
            'Porright' => '肖像权',
            'address' => '拍摄地址',
            'info' => '图片信息',
            'collectnum' => '收藏量',
        ];
    }

    public function getType0(){
        return $this->hasOne(Type::className(),['id'=>'type']);
    }

    public function getName0(){
        return $this->hasOne(User::className(),['id'=>'user_id']);
    }
}
